package xerr

var message map[uint32]string

func init() {
	message = make(map[uint32]string)
	message[OK] = "SUCCESS"
	message[SERVER_COMMON_ERROR] = "服务器开小差啦,稍后再来试一试"
	message[REUQES_PARAM_ERROR] = "参数错误"
	message[TOKEN_EXPIRE_ERROR] = "token失效，请重新登陆"
	message[TOKEN_GENERATE_ERROR] = "生成token失败"
	message[DB_ERROR] = "数据库繁忙,请稍后再试"
}

func MapErrMsg(code uint32) string {
	msg, err := message[code]
	if !err {
		return "服务器开小差啦,稍后再来试一试"
	}
	return msg
}

func IsCodeErr(code uint32) bool {
	_, ok := message[code]
	return ok
}
